<?php

/**
 * roles table
 *
 * @author     Mon Zafra <monzee at gmail>
 * @copyright  (c)2009 Mon Zafra
 * @category   Mz
 * @package    modules
 * @subpackage admin
 * @license    http://mz-project.googlecode.com/svn/trunk/LICENSE    MIT License
 * @version    SVN: $Id: Role.php 47 2009-05-28 17:56:56Z monzee $
 */
class Admin_Model_DbTable_Role extends Zend_Db_Table_Abstract
{
    protected $_name = 'roles';
    public $treeTable = 'role_graph';

    public function getParentRoles($childId)
    {
        $sel = $this->select()->setIntegrityCheck(false)
                    ->from(array('c' => $this->_name), array())
                    ->join($this->treeTable,
                           'c.id = child_id',
                           array('id' => 'parent_id'))
                    ->where('c.id = ?', $childId);
        return $this->fetchAll($sel);
    }
}